#include<bits/stdc++.h>
using namespace std;
long long n , c[200010] = {0};
int main(){
	freopen("count.in" , "r" , stdin);
	freopen("count.out" , "w" , stdout);
	cin >> n;
	for(long long i = 1 ; i <= n ; i++){
		cin >> c[i];
	}
	sort(c + 1 , c + n + 1);
	long long m = c[1];
	int count = 0;
	for(long long i = 1 ; i <= n ; i++){
		if(c[i] == m){
			count++;
		}
		else{
			cout << m << " " << count << endl;
			m = c[i];
			count = 1;
		}
	}
	cout << m << " " << count << endl;
	return 0;
}